<?php
/**
 * CK框架 结束异常 发出此异常。则整个APP结束运行
 * @author wujibing<283109896@qq.com>
 * @version   3.0
 * @category   CkFrameWork
 * @package  CkFrameWork
 * @subpackage exception
 */
class base_Exception extends Exception
{
    public function __construct($message,$code = 0)
    {
        parent::__construct($message,$code);
        echo $this;
    }
    public function __toString()
    {
        //not devpeore
        config::$configObject->CK_DEVELOP_NOW != 'true' ? exit('发生异常，需要在开发者模式下才能显示'):'';
        echo '<h1>发生错误</h1>';
    	echo '<p>错误信息：'.$this->getMessage().'</p>';
    	echo '<p>发生在?行：'.$this->getCode().'</p>';
    	echo '<p>发生文件：'.$this->getFile().'</p>';
    	echo '<p>跟踪信息：<bR>';
    	$trace = $this->getTrace();
    	$trace = array_reverse($trace);
    	foreach ($trace as $k=>$t)
    	{
    		$t['args'] = $t['args'] ?  implode(', ', $t['args']):'';
    		echo 'Trace'.$k.'  '.$t['file'].'('.$t['line'].') --> '.$t['class'].$t['type'].$t['function'].'('.$t['args'].')<bR>';
    	}
    	echo '</p>';
    	exit;
    }
}